package Day13;

import java.io.UnsupportedEncodingException;
import java.util.Arrays;

public class Text1 {
    public static void main(String[] args) throws UnsupportedEncodingException {
        //编码"
      /*  String str = "ai爱你欧";
        byte[] byte1 = str.getBytes();
        System.out.println(Arrays.toString(byte1));

        byte[] bytes2 = str.getBytes("GBK");
        System.out.println(Arrays.toString(bytes2));
*/


        //解码
       /* String str2 = new String(byte1);
        System.out.println(str2);

        String str3 = new String(byte1,"GBK");
        System.out.println(str3);
*/
        //编码
        String str1 = "ai艾利欧";
        byte[] byte1 = str1.getBytes();
        System.out.println(Arrays.toString(byte1));

        byte[] byte2 = str1.getBytes("GBK");
        System.out.println(Arrays.toString(byte2));

        //解码
        String str3 = new String(byte1);
        System.out.println(str3);

        String str4 = new String(byte2);
        System.out.println(str4);




    }
}
